/****** Object:  Stored Procedure [dbo].spPresentsGetTotalNumberList    Script Date: Monday, July 27, 2009 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spPresentsGetTotalNumberList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[spPresentsGetTotalNumberList]
GO		


CREATE PROCEDURE [dbo].spPresentsGetTotalNumberList
	@ReceiverIdList nvarchar(2000)
AS

DECLARE @sql nvarchar(2000)

SET @sql =	N'
			Select Count(1) as TotalNumber, p.ReceiverId
			From Presents p
			Where p.ReceiverId in (' + @ReceiverIdList + ')
			Group By p.ReceiverId'
EXEC (@sql)
	
GO
